package com.wyx.exception;

import com.wyx.pojo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
// 全局异常处理
@RestControllerAdvice
public class GlobalExceptionHandle {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e) {
        System.out.println(e.getMessage());
        return Result.error(e.getMessage().isEmpty() ?"服务器异常":e.getMessage());
    }
}
